using System;
using System.Collections.Generic;
using Windows.Foundation.Collections;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Core;
using Log = Logger.Debug;

namespace Xiaowei
{
    public class Helper
    {
        public static async void ForegroundActivationAsync()
        {
            Log.WriteLine("ForegroundActivationAsync");
            IEnumerable<AppListEntry> appListEntries = await Package.Current.GetAppListEntriesAsync();
            await appListEntries.First().LaunchAsync();
        }

        public static Rectangle WorkingArea()
        {
            var rc = Screen.PrimaryScreen.WorkingArea;
            Log.WriteLine($"WorkingArea, rc:{rc}");
            return rc;
        }

        public static string ValueSetToString(ValueSet value)
        {
            string msg = "{";
            foreach (var key in value.Keys)
            {
                msg += "[";
                msg += key.ToString();
                msg += ":" + value[key].ToString();
                msg += "], ";
            }
            msg += "}";

            msg = msg.Replace("], }", "]}");

            return msg;
        }
    }
}
